import 'package:flutter/material.dart';

class TextDemo extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Container(
        color: Colors.yellow,
        child: const Center(
          child: Text(
            'hello flutter',
            textDirection: TextDirection.ltr,
            style: TextStyle(
              fontSize: 40,
              fontWeight: FontWeight.bold,
              color: Colors.red,
              overflow: TextOverflow.ellipsis,
            ),
            textAlign: TextAlign.start,
          ),
        ));
  }
}

class RichTextDemo extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return RichText(
        text: const TextSpan(
            text: "out test span ",
            style: TextStyle(color: Colors.blue, fontSize: 20),
            children: [
          TextSpan(
              text: "inner 01 ",
              style: TextStyle(
                  color: Colors.greenAccent, fontWeight: FontWeight.normal)),
          TextSpan(text: "inner 02"),
        ]));
  }
}

class RowTextDemo extends StatelessWidget {
  static const String lector = "Zll";
  static const String title = "flutter";

  @override
  Widget build(BuildContext context) {
    return Container(
      color: Colors.yellow,
      child: const Row(
        children: [
          Text(
            'hello $lector $title',
            textDirection: TextDirection.ltr,
            style: TextStyle(
              fontSize: 40,
              fontWeight: FontWeight.bold,
              color: Colors.red,
              overflow: TextOverflow.ellipsis,
            ),
            textAlign: TextAlign.start,
          ),
          Text(
            ' last',
            textDirection: TextDirection.ltr,
            style: TextStyle(
              fontSize: 40,
              fontWeight: FontWeight.bold,
              color: Colors.red,
              overflow: TextOverflow.ellipsis,
            ),
            textAlign: TextAlign.start,
          )
        ],
      ),
    );
  }
}

class ContainerDemo extends StatelessWidget {
  Container container = Container(
    color: Colors.red,
    // height: 100.0,
    // width: 100,
    child: const Icon(Icons.add),
    padding: const EdgeInsets.all(30), // 内边距
    margin: const EdgeInsets.all(10),
  );

  @override
  Widget build(BuildContext context) {
    return Container(
      color: Colors.yellow,
      child: Row(
        children: <Widget>[container, container, container],
      ),
    );
  }
}
